import os
import shutil
for dir in os.listdir("../../cellseg"):
    for image in os.listdir("../../cellseg/"+dir+"/train"):
        shutil.copyfile("../../cellseg/"+dir+"/train/"+image,"data/img/"+dir.replace(".","_").replace(" ","")+image[:-4].replace(".","_")+'.png')
        shutil.copyfile("../../cellseg/"+dir+"/trainmask/"+image,"data/mask/"+dir.replace(".","_").replace(" ","")+image[:-4].replace(".","_")+'_mask.png')
for dir in os.listdir("../../cellV"):
    for image in os.listdir("../../cellV/"+dir+"/train"):
        shutil.copyfile("../../cellV/"+dir+"/train/"+image,"data/img/"+dir.replace(".","_").replace(" ","")+image[:-4].replace(".","_")+'.png')
        shutil.copyfile("../../cellV/"+dir+"/trainmask/"+image,"data/mask/"+dir.replace(".","_").replace(" ","")+image[:-4].replace(".","_")+'_mask.png')

